//package com.ruoyi.psi.base.product.controller;
//
//
//import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
//import com.ruoyi.common.core.controller.BaseController;
//import com.ruoyi.common.core.domain.AjaxResult;
//import com.ruoyi.common.core.page.TableDataInfo;
//import com.ruoyi.common.utils.poi.ExcelUtil;
//import com.ruoyi.psi.base.cost.domain.ProductionCostListDto;
//import com.ruoyi.psi.base.cost.service.IProductionCostService;
//import com.ruoyi.psi.base.product.domain.BaseProduce;
//import com.ruoyi.psi.base.product.domain.ProductionProfit;
//import com.ruoyi.psi.base.product.service.IBaseProduceService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
///**
// * 产品信息
// * @author Drj 2021/6/28
// */
//@RestController
//@RequestMapping("/psi/base/produce")
//@Api(value = "产品信息模块", tags = "产品信息接口")
//public class BaseProduceController extends BaseController {
//    @Autowired
//    private IBaseProduceService baseProduceService;
//    @Autowired
//    private IProductionCostService productionCostService;
//
//    /**
//     * 获取产品列表
//     * @param baseProduce
//     * @return
//     */
//    @ApiOperationSupport(includeParameters = {"BaseProduce.produceId", "BaseProduce.produceName", "BaseProduce.createTime"})
//    @ApiOperation(value = "获取产品列表",notes = "查询所有产品信息")
//    @PostMapping("/list")
//    public TableDataInfo list(@RequestBody BaseProduce baseProduce) {
//        startPage();
//        List<BaseProduce> baseProduceList = baseProduceService.selectBaseProduceList(baseProduce);
//        return getDataTable(baseProduceList);
//    }
//
//    /**
//     * 导出产品
//     *
//     * @param baseProduce
//     * @return
//     */
//    @PostMapping("/export")
//    public AjaxResult export(@RequestBody BaseProduce baseProduce) {
//        List<BaseProduce> list = baseProduceService.selectBaseProduceList(baseProduce);
//        ExcelUtil<BaseProduce> util = new ExcelUtil<BaseProduce>(BaseProduce.class);
//        return util.exportExcel(list, "产品数据");
//    }
//
//    /**
//     * 新增产品
//     *
//     * @param baseProduce
//     * @return
//     */
//    @ApiOperation(value = "新增产品", notes = "新增产品")
//    @ApiImplicitParam(name = "baseProduce", value = "新增产品", dataType = "BaseProduce")
//    @PostMapping("/add")
//    public AjaxResult add(@Validated @RequestBody BaseProduce baseProduce) {
//
//        try {
//            return toAjax(baseProduceService.insertBaseProduce(baseProduce));
//        } catch (Exception e) {
//            e.printStackTrace();
//            return AjaxResult.error("新增失败！");
//        }
//    }
//
//    /**
//     * 修改产品
//     * @param baseProduce
//     * @return
//     */
//    @ApiOperation(value = "修改产品", notes = "修改产品")
//    @ApiImplicitParam(name = "baseProduce", value = "修改产品", dataType = "BaseProduce")
//    @PostMapping("/edit")
//    public AjaxResult edit(@Validated @RequestBody BaseProduce baseProduce) {
//        return toAjax(baseProduceService.updateBaseProduce(baseProduce));
//    }
//
//    /**
//     * 删除产品
//     * 仅修改删除标志位
//     *
//     * @param baseProduce
//     * @return
//     */
//    @PostMapping("/delete")
//    public AjaxResult delete(@RequestBody BaseProduce baseProduce) {
//
//        return toAjax(baseProduceService.updateBaseProduceDeleteFlag(baseProduce));
//    }
//
//    /**
//     * 查询所有产品的利润
//     * @param baseProduce
//     * @return
//     */
//    @ApiOperation(value = "查询所有产品的利润",notes = "查询所有产品的利润")
//    @PostMapping("/profit")
//    public TableDataInfo selectProductionProfit(@RequestBody BaseProduce baseProduce) {
//        startPage();
//        List<ProductionProfit> productionProfitList = baseProduceService.selectProductionProfit(baseProduce);
//        return getDataTable(productionProfitList);
//    }
//
//    /**
//     * 查询具体某产品成本来源
//     * @param produceId
//     * @return
//     */
//    @ApiOperation(value = "查询具体某产品成本来源",notes = "查询具体某产品成本来源")
//    @PostMapping("/cost/{produceId}")
//    public TableDataInfo selectProductionCostById(@PathVariable String produceId) {
//        startPage();
//        List<ProductionCostListDto> productionCostListDtoList = productionCostService.selectProductionCostListListById(produceId);
//        return getDataTable(productionCostListDtoList);
//    }
//}
